perm filename PREAMB.TXT[SYS,HE]2 blob sn#012369 filedate 1972-11-13 generic text, type T, neo UTF8
COMMENT ⊗   VALID 00018 PAGES 
RECORD PAGE   DESCRIPTION
 00001 00001
 00007 00002	REQUIRE  34 VERSION COMMENT THIS NUMBER SHOULD BE UPDATED EVERY TIME A
 00009 00003	Comment     		SECTION 1 -- The Models - the 3-D TABLE MODEL
 00012 00004	Comment   2D MODEL   [SET UP BY EDGE FOLLOWER]
 00014 00005	Comment  2D REGION MODEL  [SET UP BY SIMPLE - CURRENTLY NOT USED BY ANYONE ELSE]
 00017 00006	Comment  3D MODEL -- objects in the world. [SET UP BY IIDRV AND SIMPLE - USED IN IIDRV]
 00020 00007	Comment  CAMERA MODEL
 00023 00008	Comment		 SECTION 2 --   Logical job names and flags
 00027 00009		SECTION 3 - JOB SPECIFIC MESSAGE PROCEDURES AND DATA - HE AND SYSTEM
 00029 00010	Comment 	**** EDGE ****
 00032 00011		**** VERIFIER ****
 00033 00012	Comment 		CAMERA
 00035 00013	Comment			SIMPLE
 00037 00014	YOU have found the COMPLEX page
 00040 00015	comment		COLOR 
 00042 00016	comment			*** HAND ***
 00056 00017	Comment		Section 4  --  Modules' own global data
 00059 00018	This is the edge followers very own set (no pun intended).
 00060 ENDMK
⊗;
REQUIRE  34 VERSION; COMMENT THIS NUMBER SHOULD BE UPDATED EVERY TIME A
	VARIABLE OR ITEM IS CHANGED IN ANY WAY;
Comment
THIS IS FILE PREAMB.TXT ON [II,HE]

After a title like that, anything like what follows must be considered
anti-climactic.  However, in order to eventually say END "HAND EYE SYSTEM",
we must dig in and make a start.

This file is divided into sections:
	1. The MODELS... The data representations which, to some
		extent, everyone must know about.
	2. The once_per_module data.  These include display variables,
		debugging permissions, etc.
	3. The local message procedure definitions and the semi-local
		data definitions.  These are variables which
		do not qualify under 1 or 2, but which are needed.
;
Comment     		SECTION 1 -- The Models - the 3-D TABLE MODEL

;


Comment TABLE MODEL -----    [not currently used]
	This consists of an itemvar array TABLE, whose  indices  are  x/4,y/4
	where  x  and  y are in inches, and are table coordinates. Initially,
	TABLE[i,j] is filled up with a shiny  global  item,  if  TAB_INIT  is
	TRUE. As things become known about this element, various associations
	on this item are made:

	the item for each index has an integer datum decoded as follows:
		0	grid square not scanned yet
		1	grid square completely scanned and is empty
		-1	grid square at least partially scanned and
			contains something, according to the associations.

	BLOB ⊗ TABLE[i,j] ≡ blobs known to be located in this area
		This is the first association created.  When the blob
		has been recognized completely,  this association is
		replaced by
	ON ⊗ TABLE[i,j] ≡  objects known to be located in this area
	HIDDEN ⊗ TABLE[i,j] ≡ objects hiding the area
		The squares containing this association for a given object
		are those which were covered by the BLOB association but
		not the ON association.
	HEIGHT ⊗ TABLE[i,j] ≡ and item whose real datum is the height, in
		inches of the highest point of an object which occupies
		this square.

;

Global Itemvar Array TABLE[0:11,0:19];
Global Item    ON,HEIGHT,BLOB,HIDDEN;
Global Boolean    TAB_INIT;
Comment   2D MODEL   [SET UP BY EDGE FOLLOWER]

	The 2D model is basically concerned with those elusive entities,
	BLOBs.  Each blob is represented by a global item, with some
	information saved about it.

	global datum (blob) is Karl's edge follower internal number.

	BOUNDARY ⊗ blob ≡  a real array with data about the corners of the
		outside, closed contour.  These are stored as real numbers,
		as follows:
			real array foo[1:2,0:n]
		with the convention that the x coordinate is in 1,j and the
		y coordinate is in 2,j.  These are screen coordinates.
		There are n corners.  Thus the array element 1,0 is used to
		store n (albeit in real form!).

	INSIDE_EDGES ⊗ blob ≡ a similar real array, except arranged differently:
			real array foo[1:4,0:n]
		with the convention that the edge runs from  [1,j],[2,j] to
		[3,j],[4,j] on the screen.  Again, 1,0 is used to store
		the number of such edges.

	XFORM ⊗ blob ≡  an item whose datum is the current camera transform.
		See camera stuff below.

	BLOBS contains a set of BLOB items stored there by K. Pingle which
		are now ready to be processed.;

Global set     BLOBS;

Global Item XFORM,INSIDE_EDGES,BOUNDARY;
Comment  2D REGION MODEL  [SET UP BY SIMPLE - CURRENTLY NOT USED BY ANYONE ELSE]

NOTE:  MORE INFORMATION ON COMPLEX PAGE !!!

This is the results of a region analysis of the scene.  This model will
not necessarily reside in the global data area.  However, there is no harm
in declaring its attributes to be global, so the description is included
here for clarity.

The basic unit is the SCENE.  We then make associations to locate
various objects in the scene:

	BACKGROUND ⊗ scene ≡  some specific region.
	REGION ⊗ scene ≡ all separate regions in the scene.
	BOUNDARY ⊗ region ≡ lines
	CORNER ⊗ region ≡ points
	ENDPOINT ⊗ lines ≡ points

Further, there is something linking the scene and its source blob, e.g.

	REGION_ANALYSIS ⊗ blob ≡ scene

The datums of things are quasi-important:

	datum (endpoint) is a real array [1:6]
		1-4  x,y,z,w  on table
		5,6  x,y screen coords.

;

Global Item SCENE,BACKGROUND,REGION,CORNER,ENDPT,PERIMETER;
Global Item VERTEX,BODY,LINE,POINT,EDGE;
GLOBAL ITEM BASE,ATR,OCCLUDER,ABOVE,PARENT,SON,FLAVOR;
GLOBAL ITEM TJOINT,BADT,MULTI,KJOINT,GOODX,BADX,ARROW,BADARO,GOODY,BADY;
GLOBAL ITEM GOODL,BADL, DANGLE;


COMMENT The GLOBAL MODEL contains a set of all the prototype names contained in
the GLOBAL MODEL;

GLOBAL SET PROTOTYPES;

Comment -- NOTA BENE   This previous description is wrong.  Kicha -- correct please;
Comment  3D MODEL -- objects in the world. [SET UP BY IIDRV AND SIMPLE - USED IN IIDRV]

This is the model which represents things found and completely
recognized.  However, information may be partially missing (e.g. the
colors of all faces may not yet be known).

The main association is:
	INSTANCE ⊗ prototype ≡ object.

Datum (obj) is the transform a la Gil, which takes the prototype coordinates
into a location for the object.

Each object may have a wealth of things stored about it:
	for II, the main association is always INSTANCE⊗CUBE≡object

	EDGES⊗object≡ an item whose datum is an array identical to that for
		INSIDE_EDGES containing all visible edges of the object.
		It is made by SIMPLE for the use of II and EDGE.


	FAi are global items designating the faces of the objects

	FACE⊗object≡FAi		one of these for each face of each object

	VISIBLE⊗object≡FAi	one of these for each visible face of each object

	NORMAL⊗FAi≡ the normal vector to the center of FAi

	CENTER⊗FAi≡ a two element integer array giving the center
		of the face in TV coordinates.

	COLOR⊗FAi≡some color.
;

Global Item	INVERSE,CONCAVE,SHAPE,INSTANCE,COLOR,SIZEOBJ,LEFT,RIGHT,SUPPORTER;
Global Integer Item BLUE,GREEN,RED,WHITE,ORANGE,YELLOW,NORMAL,VISIBLE;
GLOBAL ITEM EDGES,CENTER,FACE;

Comment	so that people can know what is around in the global model by
way of prototypes, SIMPLE makes the following assertion:

PROTOTYPE⊗SCENE≡prototype_name

therefore:;

GLOBAL ITEM PROTOTYPE;

Comment also the prototype names;

Global Item RPP114,RPP112,RPP122,RPP124,WEDGE122,WEDGE124,RHOMBOID,LBEAM,CUBE;

Global Integer GOT_MODELS; comment set if the global prototypes are read in;
Comment  CAMERA MODEL

This model has all good things about the camera.

There is an itemvar called CURCAM which contains an
item whose datum is an array which completely describes the view
from the camera.All references to TRANSFORMs are references to items
of this variety.;

Global Real Array CAMERA_MODEL,CAMERA_PREDI[1:10,1:3];
	Comment  1:3,1:3 is colineation matrix (TABLE → SCREEN),
		  4 ,1:3 is lens center coords
		  5 ,1:2 screen coords of Piercing Point
		 6:8,1:3 inverse colineation matrix (SCREEN→TABLE)
		  9 ,1:3 CAMPAN, CAMTIL, CAMRANG
                  10,1:2 CAMERA NO. CAMLENS
		 MODEL has the current transforms, PREDI has the predicted 
		 transforms for the point req. last in CAM_PRED;

GLOBAL INTEGER CAMFLG,CAMLENS;
GLOBAL REAL CAMPAN,CAMTIL,CAMRANG;
Global Real Array Itemvar CURCAM;
GLOBAL REAL ARRAY A_REC,AI_REC[1:3,1:3],LENS_REC[1:3];
Global Real PANPOT,TILPOT,FOCPOT;

Comment    CORNER FINDER(EYE) MODEL;
 
GLOBAL INTEGER EYEFLG;
GLOBAL REAL ARRAY DIR_EYE[0:10,1:8];
comment	 DIR[.,1],DIR[.,2],DIR[.,3],DIR[.,4], direction cosines of corner sides
	 DIR[.,5],DIR[.,6]-screen coords of corner
	 DIR[.,7]=0 if corner, 1 if line
	 DIR[.,8]=0 if match, 1 if only 1st. edge match, 2 if 2nd. match
	 different rows are for different features found in the same window;
GLOBAL INTEGER ARRAY LOOK_AT[1:8];
comment	LOOK_AT[1]-camrea number: 1-old camera, 2-new camera(don`t use yet)
	LOOK_AT[2],LOOK_AT[3]-screen coordinates of center of window
	LOOK_AT[4]-width of window
	LOOK_AT[5]-hight of window
  	LOOK_AT[6],LOOK_AT[7]-TCLIP,BCLIP
	LOOK_AT[8]-sensitivity;

comment	  AUTO FOCUSSING MODEL;

GLOBAL INTEGER FOCFLG;
comment for error indication;
GLOBAL REAL FOCRANG,FOCDELF;
comment FOCRANG is the range estimate to best focus.
	FOCDELF is the estimate of range uncertainty;
Comment		 SECTION 2 --   Logical job names and flags

These logical names are those for the global flags only.  They should
not be confused with the logiccal names used by the message procedure
routines or by and hand/eye monitor, although it would be nice if they
were all the same.

Table of logical names:

EDGE		Karl Pingle and the edge followers, riding in shining armour.
CUR		CURVE FITTER
SIMP		Gil's easiest way to success, though not the surest.
CAM		The camera mover minded by A Gill. (Formerly the eye itself, and its mentor, I Sobel.
VER		J.M. Tenenbaum's  line verifyer
SEG		THE SEGMENTER - GUZMAN REINCARNATED A LA FALK
REC		THE COMPLEX SCENE DESCRIBER - WHAT IS WHERE?
PRED		PREDICTOR-HIDDEN LINE ELIMINATOR -SLOW BUT STEADY WINS THE RACE!
COL		Color recognizer.
HAND		The arm program
MOVE		Yet another arm program - two arms are better than one
GUN		GUNNAR'S REGION FINDER
DRV		CONTRL PROGRAM
EYE		Gill's corner search and match, you are welcome to try it.
FOC		Automaic-Focus. Ask J.M.T  about thery, Gill about practice.

Template data:

DEB_@		If TRUE, you may put debugging information on the disk.
DIS_@		If TRUE, you may disply to your heart's content.
YES_@		You should set to TRUE as you initialize.
TYP_@		You may type out anything you please -- don't go into wait,tho.

BELOW ARE THE CURRENTLY USED GLOBAL FLAGS;

Global Integer DEB_EDGE,DIS_EDGE,YES_EDGE,TYP_EDGE;
GLOBAL INTEGER DEB_CUR,DIS_CUR,YES_CUR,TYP_CUR;
Global Integer DEB_SIMP,DIS_SIMP,YES_SIMP,TYP_SIMP;
Global Integer DEB_CAM,DIS_CAM,YES_CAM,TYP_CAM;
Global Integer DEB_VER,DIS_VER,YES_VER,TYP_VER;
Global Integer DEB_COL,DIS_COL,YES_COL,TYP_COL;
Global Integer DEB_II,DIS_II,YES_II,TYP_II;
GLOBAL INTEGER DEB_GUN,DIS_GUN,YES_GUN,TYP_GUN;
GLOBAL INTEGER DEB_EYE,DIS_EYE,YES_EYE,TYP_EYE;
GLOBAL INTEGER DEB_HAND,DIS_HAND,YES_HAND,TYP_HAND;
GLOBAL INTEGER DEB_MOVE,DIS_MOVE,YES_MOVE,TYP_MOVE;
Global Integer DEB_SEG,DIS_SEG,YES_SEG,TYP_SEG;
Global Integer DEB_REC,DIS_REC,YES_REC,TYP_REC;
Global Integer DEB_PRED,DIS_PRED,YES_PRED,TYP_PRED;
Global Integer DEB_FOC,DIS_FOC,YES_FOC,TYP_FOC;
COMMENT		SECTION 3 - JOB SPECIFIC MESSAGE PROCEDURES AND DATA - HE AND SYSTEM;

Define mp="Forward Message Procedure";
Define smp="Forward Simple Message Procedure";

comment		the run number which is honest only if HE is controling this mess;

global integer RUN;


comment		the message procedure trace flag, which is defined in the 
		second segment;

EXTERNAL BOOLEAN TRACING;

comment	misc. items;

GLOBAL ITEM NIL, EVERY;

Comment		table of free display frames for h/e version of Quam display code;

GLOBAL INTEGER ARRAY GDISP[0:14];
GLOBAL INTEGER GDISP_INIT; Comment this is the initialization flag for GDISP;

comment	this is the monitors only public message procedure, TRACE can only be called
	from the second segment;

smp MON_COM(string command);

Comment	=-1 if monitor on data disk, 1 if on III, 0 if no monitor;

GLOBAL INTEGER DISDEV;
Comment 	**** EDGE ****

For a detailed description of these procedures, see EYE.WRU[SYS,HE].
Only the definitions themselves are given here.;

COMMENT		MISC. PROCEDURES;

mp GETDATA ( ITEMVAR arg; reference boolean flag);
smp DISK ( string name; reference boolean flag);
smp TV;
smp XEQ ( string command; reference boolean flag);
smp DEBUG ( string name; string val; reference boolean flag);
smp RESTART_KKP;
smp SETVAL ( string name; integer val; reference boolean flag);
MP GLBDMP(SET A);

comment		main calls;

mp FIND ( ITEMVAR arg );
mp RELOOK ( ITEMVAR arg; INTEGER x, y ); 
mp FIT ( ITEMVAR arg );
mp INSIDE ( ITEMVAR arg );
mp COMPACT ( ITEMVAR arg );
mp INSCAN(integer a,b,c,d;REFERENCE INTEGER Z);
mp REJECT ( ITEMVAR arg );
MP FINE(ITEMVAR ARG);
mp GUNTRACE ( set blobs; integer file);

Comment these last nine return a message (to be found in you the caller):;

mp RESPONSE ( string name; integer arg; integer status );

comment		the next message links to gunnar;

mp DATA ( integer file;reference integer fname);

MP SEND_DATA ( INTEGER COUNT; REAL ARRAY DAT);

Comment this last returns a message (to be found in you the caller):;

mp EDGE_DATA ( integer size; real array arrx );

comment	the next message links to the curve fitter;

MP CURVE_FIT(REAL ARRAY DATA);
COMMENT		**** VERIFIER ****;

mp VERIFY(INTEGER X1, Y1, X2, Y2; REFERENCE REAL CONF); COMMENT CONF IS CONFIDENCE;

GLOBAL REAL CONFID;	COMMENT THIS IS TO RETURN CONF;
Comment 		CAMERA

For now, this is very simple, and will merely involve reading a
camera model from the disk, reading pan tilt pots, and creating
the matrices described in the camera model.
Now, at last, we are more sofisticated: you can also MOVE the camera!
;

SIMPLE mp CAM_UPDATE;
SIMPLE mp CAM_INIT ;
   comment read in an initialized model...;

SIMPLE mp CHNG_LENS(INTEGER LENS);
   comment 1-25mm, 2-50mm, don't try other yet;

SIMPLE mp MOVE_CAM(REAL PAN,TILT);
   comment PAN from -X into table, TILT from horizon down, in RADs;

SIMPLE mp CHNG_FOCUS(REAL RANGE);
   comment RANGE in inchs;

SIMPLE mp CAM_CENTER(INTEGER LENS; REAL X,Y,Z);
   comment X,Y,Z, in table coordinates;

SIMPLE mp CAM_PRED(INTEGER LENS; REAL X,Y,Z);
   comment X,Y,Z, in table coordinates;

Comment			SIMPLE

These are preliminary at best.
Prototypes must be in the global segment specified when running SIMPLE.
The global segment can be created by running MAKSEG.DMP on [SYS,HE].

Simplefit is called to try to recognize the blob.  Status is returned.
;


mp SIMP_FIT ( item blob ;reference integer status; reference real array itemvar x);

Comment Status is returned .....
	0 -- perfect match to a prototype.  The new item created
		for the instance is in x.
	-1 -- no BOUNDARY or TRANSFORM information in global model.
	1 -- wrong number of outside edges for us.
	2 -- screwup in matching process.

;
mp SIMP_UPDATE ( real array itemvar obj; real array trans; reference integer stat);

COMMENT adjusts the world model for obj being moved TO (underlined and italicized)
	trans;

COMMENT	YOU have found the COMPLEX page

Some words about the model are in order here (i think)...
COMPLEX wants the following global model associations:

GLOBAL INPUT MODEL:

	POINT⊗<scene>≡<point>
	LINE⊗<scene>≡<line>
		ENDPT⊗<line>≡<point 1>
		ENDPT⊗<line>≡<point 2>
	REGION⊗<scene>≡<region>
		PERIMETER⊗<region>≡<list item>
	BACKGROUND⊗<scene>≡<region>
	TRANSFORM⊗<scene>≡<array item>

with the following datums:
	∂(<point>)=<array item> s.t.
		∂(<pt>)[1]= tv x coor
		∂(<pt>)[2]= tv y coor
		∂(<pt>)[6]= display x coor
		∂(<pt>)[7]= display y coor
	∂(<list item>) = list of vertices around the regions
	∂(<array item>) = 10 x 3 camera transform
	
after sufficient thrashing around a description of the above input
data is put out in the form of bodies:

GLOBAL OUTPUT MODEL:

	BODY⊗<scene>≡<body>
		LINE⊗<body>≡<line>
		POINT⊗<body>≡<point>
		REGION⊗<body>≡<region>
			BOUNDARY⊗<region>≡<line>
			CORNER⊗<region>≡<point>


COMPLEX currently consists of three jobs:
	RECOGNIZER	JOB1
	SEGMENTER	JOB2
	PREDICTOR	JOB3

The order of operation is:
1	JOB1 calls JOB2
2	JOB2 separates the scene and supplies support and occluder
	data for the global model
3	JOB1 returns to do its recognizer thing
4	then JOB1 calls JOB3 to verify that it got the right answer
;


COMMENT THE RECOGNIZER;
FORWARD MESSAGE PROCEDURE ANALYZE(ITEMVAR SCENE);
FORWARD MESSAGE PROCEDURE PREDICT;

COMMENT THE SEGMENTER;
FORWARD MESSAGE PROCEDURE SEGMENT;


COMMENT	PREDICTOR-HIDDEN LINE ELIMINATOR;
FORWARD MESSAGE PROCEDURE
	CHECK (ITEMVAR SCENE);




comment		COLOR ;

mp CLR_GET ( INTEGER N; REAL ARRAY POINTS);
	Comment call to get colors for points. POINTS is indexed
		by [1:2,1:N] for x,y screen coords of places to look;

mp CLR_RESPONSE ( INTEGER ITEMVAR ARRAY GJ);
	Comment this is the response for colors;



comment		EYE;

SIMPLE mp SRCH_IMAGE(INTEGER BKGR,INT,SEARCH; REAL TOLER; REAL ARRAY DIRD);
comment Jack_of_all_trades, see explanation below
	BKGR- -1 for dark background, 1 for light background, 0 for all regions
	INT-intensity match 1-for darker inside, -1-for lighter inside, 
		            0-for no match
        SEARCH-width of window to search (in LOOK_AT[4] units,
	       0 for no search but recentering allowed,
	       if SEARCH<0 -SEARCH is the number of features looked for
	TOLER-tolerance for matching .05 is a good number, -1 for no match;

SIMPLE mp SET_WINDOW;
comment for testing and helping purposes;

comment   AUTOFOC;

mp AUTOFOC(REAL EST_RANG,RANGINVAL; INTEGER NCUT);
comment EST_RANG: initial estimataed range in inches.
        RANGINVAL: initial range uncertainty in inches.
        NCUT: value of CUT (0 to 15. usually 4) or -1 for automatic;
comment			*** HAND ***
;
DEFINE TSX="1.0017",TSY="1.0028";
comment	where real x = table x * tsx  and real y = table y * tsy
	these are the conversion factors from table inches to real inches;
GLOBAL INTERNAL INTEGER ARM_MOTION,ARM_STATUS,ARM_SEGMENT,ARM_WAIT,ARM_TIME,ARM_EXECUTE;
comment	ARM_MOTION contains the file name (in sixbit) of the trajectory being executed
	with the arm in motion, it is set to zero on the completion
	of execution.
	If an execution error occurs ARM_MOTION is cleared and the file name
	is set into ARM_WAIT.
	ARM_STATUS at the completion of execution of each trajectory
	is set as follows:
		0	all O.K.
		1	overflow occured
		<n>1	execution terminated due to excessive force at joint n
		2	grasp error, hand closed less than the minimun distance.
		3	file not found
		4	enter for data file failed
		5	disk not found
		<n>6	Arm stopped on touching the n'th sensor
		7	A/D read error
		20	excessive time
		22	hand takes excessive time
		23	Arm failed to stop on force limit
		24	Arm in control loop
		30	the arm is down
		40	message invalid, arm not in wait state
		50	file read error
		60	wrong servo version number
		70	reference supply is off, check fuse and restart program
		100	the PDP-6 is down
		200	PDP-6 Parity error occured

	ARM_SEGMENT initially zero at the beginning of execution of each
	trajectory file is incremented as each part trajectory is started

	ARM_TIME is set to zero by START_TRAJECTORY and is incremented
	by the estimated time in jiffies that the trajectory will take,
	each time MOVE_ARM is called

	ARM_EXECUTE if true the arm function is executed immediately execpt for
	the trajectory functions;


GLOBAL INTERNAL BOOLEAN STOP_ON_TOUCH;
comment	if this is true the arm will stop if it touches anything that it
	can feel during any trajectories executed after it is set;

FORWARD MESSAGE SIMPLE PROCEDURE SET_TOUCH(BOOLEAN STOP_ON_TOUCH);
comment	this is a planning function and allows the touch state to be changed
	during execution for the next function;

GLOBAL INTERNAL INTEGER ARRAY FELT[1:2,1:4,1:4];
comment	if the arm stops on touching something this contains the information
	as to which element did the touching;

GLOBAL REAL ARRAY ARM_LINK[3:6,1:4,1:4];
comment	These 4, 4x4 arrays contain the current positions of the last four
	links of the arm. They are updated after every arm motion, and
	when the arm is in the wait state;

GLOBAL REAL GRASP;
comment	This contains the opening between the fingers in inches;

FORWARD MESSAGE SIMPLE PROCEDURE ARM_CONO(REAL ARRAY ARRIVE,DEPART,OBJECT;INTEGER ARRIVE_TIME,DEPART_TIME);
comment	this is a planning function allowing arrive, depart vectors to be set when this
	message is executed, also object is a 1x4 array containing the mass
	and three radii of gyration of the object to be moved;

FORWARD MESSAGE SIMPLE PROCEDURE START_TRAJECTORY(STRING FILE;BOOLEAN START_FROM_LAST);
comment	This procedure is called to start every trajectory, If START_FROM LAST 
	is TRUE then the trajectory  will start from the last planned position, otherwise
	it will start from the present arm position, needless to say if the arm
	isn't physically where the trajectory starts from there will trouble;

FORWARD MESSAGE SIMPLE PROCEDURE MOVE_ARM(REAL ARRAY JOINT6; REFERENCE INTEGER FLAG);
comment	This and the next two procedures generate trajectories from the last
	place a trajectory was planned to, to the new position.
	Given a transform for the JOINT6( with the orign located between
	the finger tips and 0.375 inches in, the z axis aligned with the fingers
	and pointing out and the unit y vector pointing from one finger tip to 
	the other), this procedure finds an arm solution and checks that it does
	not put the arm through the table or through its support post, and
	generates a trajectory returning TRUE in FLAG;

FORWARD MESSAGE PROCEDURE MOVE_INSTANCE
(REAL ARRAY ITEMVAR INSTANCE;REAL ARRAY NEW_TRANSFORM,INTERMEDIATE_POSITION;
	REFERENCE INTEGER PLAN);
comment	This procedure generates a trajectory to move the arm from the last planned
	position, to pick up the INSTANCE of some prototype and to move it
	to NEW_POSITION using INTERMEDIATE_POSITION if necessary,
	status is returned in PLAN as follows:
		-1	There is no way the hand can grasp the instance
		-2	The hand cannot reach the instance at its initial position
		-3	The hand cannot reach the instance at its final position
		-4	There is no way using the present intermediate position
	that the move can be made, another INTERMEDIATE_POSITION might help.
		-5	This instance has either too few or too many prototypes
		2	Trajectory generated without using the intermediate position
		4	Trajectory generated using the intermediate position
	Note if the INTERMEDIATE_POSITION is cleared to zero then the instances
	present position will be used as such
	this message proceedure is now in module "MOVE" which in turn sends
	messages to "HAND",no messages should be sent to HAND until MOVE has
	finished;

FORWARD MESSAGE SIMPLE PROCEDURE PARK_ARM;
comment	Generates a trajectory to the park position;

FORWARD MESSAGE SIMPLE PROCEDURE OPEN_HAND(REAL OPENING);
comment	This causes the hand to open or close to OPENING at this point in the trajectory
	if opening it does not stop on touch;

FORWARD MESSAGE SIMPLE PROCEDURE CLOSE_HAND(REAL MINIMUN_DISTANCE);
comment	This causes the hand to close at this point in the trajectory,
	and if so doing it closes more than MINIMUN_DISANCE execution is stopped
	and ARM_STATUS is set to 2
	it does not stop on touch;

FORWARD MESSAGE SIMPLE PROCEDURE PLACE_ARM;
comment	This causes the hand to decend vertically until it meets some resistance
	It should be able to drop approximately 1/2 inch before stopping;

FORWARD MESSAGE SIMPLE PROCEDURE CHANGE_ARM(REAL ARRAY DX_DY_DZ;REAL DIST;
	REAL ARRAY AXIS;REAL DEG;INTEGER TIME;REFERENCE INTEGER FLAG);
comment	At this point in the trajectory the arm will make the appropiate 
	differential motion specified by the first three elements of DX_DY_DZ
	scaled by DIST, it will also rotate DEG degrees about axis AXIS.
	the action will take at least TIME jiffies
	If the motion drives the arm beyond its physical limits no action is planed
	and FALSE is returned;

FORWARD MESSAGE SIMPLE PROCEDURE WAIT_ARM;
comment	This procedure causes the arm to pause in execution and go into a wait state;

FORWARD MESSAGE SIMPLE PROCEDURE CLOSE_TRAJECTORY;
comment	This closes the trajectory file, a good idea;

FORWARD MESSAGE SIMPLE PROCEDURE DO_IT(STRING FILE);
comment	This executes trajectory FILE;

FORWARD MESSAGE SIMPLE PROCEDURE DO_PROCEED;
comment	Execution of this procedure when in the wait state causes the arm to
	proceed with its planned trajectory;

FORWARD SIMPLE MESSAGE PROCEDURE ARM_POSITION;
Comment	This causes the arm position to be read and should not be used unless
	the arm has been moved without power on;

FORWARD MESSAGE SIMPLE PROCEDURE STOP_ARM(REAL ARRAY F,V;REFERENCE INTEGER STAT);
Comment	This will cause the arm to stop when it exerts a force or moment
	in the direction specified, if it fails to stop then error 23 results
	If stat is false then the force specified is too small and no action is planned;
	

FORWARD SIMPLE MESSAGE PROCEDURE ARM_SKIPE(INTEGER ERROR);
Comment	This causes the arm to skip the next function it was going to perform
	if error ERROR occured;

FORWARD SIMPLE MESSAGE PROCEDURE ARM_SKIPN(INTEGER ERROR);
Comment	This causes the arm to skip the next function it was going to perform
	if error ERROR did not occur;

FORWARD SIMPLE MESSAGE PROCEDURE ARM_SKIPs(INTEGER ERROR);
Comment	This causes the arm to skip the next function it was going to perform
	if error ERROR ored with the variable bits occured;

FORWARD SIMPLE MESSAGE PROCEDURE ARM_JMP(INTEGER N);
Comment	This causes the arm to jump backwards or forwards N functions;

FORWARD SIMPLE MESSAGE PROCEDURE MERGE_ARM;

FORWARD SIMPLE MESSAGE PROCEDURE CENTER_HAND(REAL MINIMUM_DISTANCE);
comment	this is the same as CLOSE_HAND except that it centers the hand 
	before closing;

FORWARD SIMPLE MESSAGE PROCEDURE DRIVE_ARM(INTEGER JOINT;REAL DEGREES;INTEGER TIME;REFERENCE INTEGER FLAG);
comment	causes a singlejoint to be driven;

FORWARD SIMPLE MESSAGE PROCEDURE ARM_SAVE(INTEGER I);
comment	causes the differential deviation to be saved in the i'th cell;

FORWARD SIMPLE MESSAGE PROCEDURE ARM_RESTORE(INTEGER I);
comment	causes the differential deviation to be restored from the i'th cell;

Comment		Section 4  --  Modules' own global data

COMMENT		THIS IS FOR THE CURVE FITTER;

GLOBAL INTEGER CURVE_STATUS;


COMMENT THIS IS IRWIN'S THING ;
GLOBAL INTEGER FLAG_CAM ;


COMMENT  THIS PAGE HAS FLAGS AND CALIB. CONSTANTS FOR ACCOMODATION ROUTINES
	 IN EDGE FOLLOWER, COLOR, FOCUS, VERIFIER;

GLOBAL INTEGER COLFILT_ACC;		COMMENT	FILTER COLOR: 0-RED, 1-BLUE, 2-GREEN, 3-CLEAR;
GLOBAL INTERNAL INTEGER DAC_ACC;	COMMENT CURRENT DAC SETTING;
GLOBAL BOOLEAN CHANGE_ACC;		COMMENT TRUE IF SCENE CHANGED;
GLOBAL	BOOLEAN SENSCAL_ACC;		COMMENT HAS SENS BEEN CALIBRATED;
GLOBAL	BOOLEAN AUTOCAL_ACC;		COMMENT TABLE_ACC INITIALIZED;
GLOBAL INTERNAL INTEGER AUTO_ACC;	COMMENT SETTING OF DAC AT AUTOTARGET THRES. FOR CURRENT FILTER;
GLOBAL	INTEGER SENSIGN_ACC;		COMMENT DIR. OF LAST CHANGE IN TAR. VOLT.-TO AVOID LOOPS.
					   1: UP, -1: DOWN, 0-NOT YET CHANGED;
GLOBAL INTEGER ARRAY TABLE_ACC[0:63];	COMMENT HOLDS AD READINGS FOR DAC SETTINGS;
GLOBAL INTEGER ARRAY FIL_ACC[0:3];	COMMENT AUTO TARGET FOR EACH FILTER, 0 IF NOT INITED;

GLOBAL REAL FCALPOTC_ACC,FCALPOTD_ACC,F_ACC,FNUM_ACC,CIRCONFUS_ACC;
	COMMENT FOCUS AND LENS CALIBRATION CONSTANTS;

GLOBAL BOOLEAN SENSFLAG_ACC;		COMMENT TRUE-SENSITIVITY CAN SAFELY BE RAISED
						FALSE-CANT RAISE SENSITIVITY;
GLOBAL BOOLEAN SENDWNFG_ACC;		COMMENT SENSITIVITY CANNOT BE FURTHER LOWERED;


Comment  	Instant Insanity Area;

Global Real Array Itemvar ITVAR_II;

COMMENT		SOLUTION⊗object≡ a four element integer array giving the
			faces i of Fi which must be oriented with their normals
			parallel to the X-Y plane and pointing in a consistant
			direction to get a solution;

GLOBAL ITEM SOLUTION;
GLOBAL INTEGER STAT_II;

COMMENT elements of this array are given to HAND to put status in so
	we can parallel process;

GLOBAL INTEGER ARRAY ARM_STAT[1:10];
COMMENT This is the edge followers very own set (no pun intended).;
GLOBAL SET OLDBLOB;

COMMENT	THIS IS TO PASS FILE NAMES BACK FROM GUNNAR;

GLOBAL INTEGER FNAME;



comment			THE ARM'S GLOBALS;
GLOBAL INTERNAL SAFE REAL ARRAY ARM_VECTOR[1:7];
GLOBAL INTERNAL SAFE REAL ARRAY ARM_TORQUE[1:6];
GLOBAL SAFE REAL ARRAY ITEM TEST_BLOCK[1:4,1:4];
GLOBAL INTEGER ARM_PLAN;
GLOBAL SAFE REAL ARRAY FREE_ARM[0:6,1:6];
GLOBAL SAFE REAL ARRAY FORCE_ARM[1:6];